//
//  EidtViewController.m
//  CarTown
//
//  Created by xionghao on 15/9/9.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "EidtViewController.h"

@interface EidtViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textfield;


@end

@implementation EidtViewController
+(instancetype)viewcontroller{
    EidtViewController *vc=[[EidtViewController alloc]initWithNibName:NSStringFromClass([self class]) bundle:nil];
    return vc
    ;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title=self.titletxt;
   
    self.textfield.placeholder=[NSString stringWithFormat:@"请输入%@",self.titletxt];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)baocunclick:(id)sender {
    
    if (self.textfield.text.length>0) {
        
        UIViewController *vc=[self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-3];
       
        
        if ([_delegate respondsToSelector:@selector(EidtViewControllerClick:)]) {
            [_delegate EidtViewControllerClick:self.textfield.text];
        }
        [self.navigationController popToViewController:vc animated:YES];
    }else{
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=self.titletxt;
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
    }
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
